# Define project
cmake_minimum_required(VERSION 2.6)
project(OpenStreetMap-3D-Viewer)

# Include helpers
include(${CMAKE_SOURCE_DIR}/cmake/common.cmake)

if(CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++0x")
endif()

# Set target name
set(target OpenStreetMap-3D-Viewer)

# Include QT4, OpenSceneGraph and proj.4 libraries
find_package(OpenSceneGraph REQUIRED osgViewer osgGA osgDB osgUtil osgQt)
find_package(Proj REQUIRED)
find_package(Qt4 COMPONENTS QtCore QtOpenGL QtGui QtXML REQUIRED)
include(${QT_USE_FILE})

# Set include directories
include_directories(
    ${OPENSCENEGRAPH_INCLUDE_DIRS}
    ${PROJ_INCLUDE_DIR}
)

# Define source files
set(sources
    src/main.cpp
    src/QtViewer.cpp
    src/QtViewer.h
    src/OSMHandler.h
    src/OSMHandler.cpp
    src/CoordTransformer.h
    src/CoordTransformer.cpp
    src/StreetNode.h
    src/StreetNode.cpp
    src/AreaNode.h
    src/AreaNode.cpp
    src/BuildingNode.h
    src/BuildingNode.cpp
    src/PointOfInterestNode.h
    src/PointOfInterestNode.cpp
    src/InputEventHandler.h
    src/InputEventHandler.cpp
    src/ConfigWidget.h
    src/ConfigWidget.cpp
	src/OSMNode.h
	src/OSMNode.cpp
	src/OSMWay.h
	src/OSMWay.cpp
	src/OSMRelation.h
	src/OSMRelation.cpp
	src/ToggleNode.h
	src/ToggleNode.cpp
)

# Run Qt4 preprocessor
qt4_auto_wrap(sources ${sources})

# Create executable
add_executable(${target} ${sources})
target_link_libraries(${target}
    ${QT_LIBRARIES}
    ${OPENSCENEGRAPH_LIBRARIES}
    ${PROJ_LIBRARY}
)
